package Model;

import java.util.ArrayList;

import DAO.InterfaceDAO.LibraryDAO;
import Factories.FactoryDAO;

public class Library {

	private String nom;
	private ArrayList<Exercice> exercices;
	private ArrayList<Cour> cours;
	private LibraryDAO ldao;

	public Library() {
		this.ldao = FactoryDAO.getInstance(null).createLibDAO();
	}

	public Library(String nom) {
		this.nom = nom;
		exercices = new ArrayList<Exercice>();
		cours = new ArrayList<Cour>();
		this.ldao = FactoryDAO.getInstance(null).createLibDAO();
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public ArrayList<Exercice> getExercices() {
		return exercices;
	}

	public ArrayList<Cour> getCours() {
		return cours;
	}

	public void addCours(Cour c) {
		cours.add(c);
	}

	public void supCour(int id) {
		for(int i=0;i<cours.size();i++){
			if (cours.get(i).getId()==id){
				cours.remove(i);
			}
		}
	}

	public void addExercice(Exercice c) {
		exercices.add(c);
	}

	public void supExercice(int id) {
		for(int i=0;i<exercices.size();i++){
			if (exercices.get(i).getId()==id){
				exercices.remove(i);
			}
		}
	}

}
